<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE OverloadedStrings, CPP #-}</span><span>
</span><span id="line-2"></span><span class="hs-pragma">{-# LANGUAGE Safe #-}</span><span>
</span><span id="line-3"></span><span>
</span><span id="line-4"></span><span class="hs-comment">-- |</span><span>
</span><span id="line-5"></span><span class="hs-comment">-- Module      : Data.Text.Lazy.Read</span><span>
</span><span id="line-6"></span><span class="hs-comment">-- Copyright   : (c) 2010, 2011 Bryan O'Sullivan</span><span>
</span><span id="line-7"></span><span class="hs-comment">--</span><span>
</span><span id="line-8"></span><span class="hs-comment">-- License     : BSD-style</span><span>
</span><span id="line-9"></span><span class="hs-comment">-- Maintainer  : bos@serpentine.com</span><span>
</span><span id="line-10"></span><span class="hs-comment">-- Portability : GHC</span><span>
</span><span id="line-11"></span><span class="hs-comment">--</span><span>
</span><span id="line-12"></span><span class="hs-comment">-- Functions used frequently when reading textual data.</span><span>
</span><span id="line-13"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">Data.Text.Lazy.Read</span><span>
</span><span id="line-14"></span><span>    </span><span class="hs-special">(</span><span>
</span><span id="line-15"></span><span>      </span><span class="annot"><a href="Data.Text.Lazy.Read.html#Reader"><span class="hs-identifier">Reader</span></a></span><span>
</span><span id="line-16"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#decimal"><span class="hs-identifier">decimal</span></a></span><span>
</span><span id="line-17"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#hexadecimal"><span class="hs-identifier">hexadecimal</span></a></span><span>
</span><span id="line-18"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#signed"><span class="hs-identifier">signed</span></a></span><span>
</span><span id="line-19"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#rational"><span class="hs-identifier">rational</span></a></span><span>
</span><span id="line-20"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#double"><span class="hs-identifier">double</span></a></span><span>
</span><span id="line-21"></span><span>    </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-22"></span><span>
</span><span id="line-23"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.html#"><span class="hs-identifier">Control.Monad</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#liftM"><span class="hs-identifier">liftM</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-24"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Char.html#"><span class="hs-identifier">Data.Char</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Unicode.html#isDigit"><span class="hs-identifier">isDigit</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Unicode.html#isHexDigit"><span class="hs-identifier">isHexDigit</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-25"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Int.html#"><span class="hs-identifier">Data.Int</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Int.html#Int8"><span class="hs-identifier">Int8</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int16"><span class="hs-identifier">Int16</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int32"><span class="hs-identifier">Int32</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int64"><span class="hs-identifier">Int64</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-26"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Ratio.html#"><span class="hs-identifier">Data.Ratio</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Real.html#%25"><span class="hs-operator">(%)</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-27"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.Text.Internal.Read.html"><span class="hs-identifier">Data.Text.Internal.Read</span></a></span><span>
</span><span id="line-28"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.Text.Lazy.html"><span class="hs-identifier">Data.Text.Lazy</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">T</span></span><span>
</span><span id="line-29"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Word.html#"><span class="hs-identifier">Data.Word</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Word"><span class="hs-identifier">Word</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier">Word8</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word16"><span class="hs-identifier">Word16</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word32"><span class="hs-identifier">Word32</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word64"><span class="hs-identifier">Word64</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-30"></span><span>
</span><span id="line-31"></span><span class="hs-comment">-- | Read some text.  If the read succeeds, return its value and the</span><span>
</span><span id="line-32"></span><span class="hs-comment">-- remaining text, otherwise an error message.</span><span>
</span><span id="line-33"></span><span class="hs-keyword">type</span><span> </span><span id="Reader"><span class="annot"><a href="Data.Text.Lazy.Read.html#Reader"><span class="hs-identifier hs-var">Reader</span></a></span></span><span> </span><span id="local-6989586621679113689"><span class="annot"><a href="#local-6989586621679113689"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="Data.Text.Internal.Read.html#IReader"><span class="hs-identifier hs-type">IReader</span></a></span><span> </span><span class="annot"><a href="Data.Text.Internal.Lazy.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679113689"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-34"></span><span class="hs-keyword">type</span><span> </span><span id="Parser"><span class="annot"><a href="Data.Text.Lazy.Read.html#Parser"><span class="hs-identifier hs-var">Parser</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="Data.Text.Internal.Read.html#IParser"><span class="hs-identifier hs-type">IParser</span></a></span><span> </span><span class="annot"><a href="Data.Text.Internal.Lazy.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-35"></span><span>
</span><span id="line-36"></span><span class="hs-comment">-- | Read a decimal integer.  The input must begin with at least one</span><span>
</span><span id="line-37"></span><span class="hs-comment">-- decimal digit, and is consumed until a non-digit or end of string</span><span>
</span><span id="line-38"></span><span class="hs-comment">-- is reached.</span><span>
</span><span id="line-39"></span><span class="hs-comment">--</span><span>
</span><span id="line-40"></span><span class="hs-comment">-- This function does not handle leading sign characters.  If you need</span><span>
</span><span id="line-41"></span><span class="hs-comment">-- to handle signed input, use @'signed' 'decimal'@.</span><span>
</span><span id="line-42"></span><span class="hs-comment">--</span><span>
</span><span id="line-43"></span><span class="hs-comment">-- /Note/: For fixed-width integer types, this function does not</span><span>
</span><span id="line-44"></span><span class="hs-comment">-- attempt to detect overflow, so a sufficiently long input may give</span><span>
</span><span id="line-45"></span><span class="hs-comment">-- incorrect results.  If you are worried about overflow, use</span><span>
</span><span id="line-46"></span><span class="hs-comment">-- 'Integer' for your result type.</span><span>
</span><span id="line-47"></span><span id="local-6989586621679113813"><span class="annot"><a href="Data.Text.Lazy.Read.html#decimal"><span class="hs-identifier hs-type">decimal</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Real.html#Integral"><span class="hs-identifier hs-type">Integral</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679113813"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#Reader"><span class="hs-identifier hs-type">Reader</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679113813"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-48"></span><span class="hs-pragma">{-# SPECIALIZE</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#decimal"><span class="hs-pragma hs-type">decimal</span></a></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#Reader"><span class="hs-pragma hs-type">Reader</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-pragma hs-type">Int</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-49"></span><span class="hs-pragma">{-# SPECIALIZE</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#decimal"><span class="hs-pragma hs-type">decimal</span></a></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#Reader"><span class="hs-pragma hs-type">Reader</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int8"><span class="hs-pragma hs-type">Int8</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-50"></span><span class="hs-pragma">{-# SPECIALIZE</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#decimal"><span class="hs-pragma hs-type">decimal</span></a></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#Reader"><span class="hs-pragma hs-type">Reader</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int16"><span class="hs-pragma hs-type">Int16</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-51"></span><span class="hs-pragma">{-# SPECIALIZE</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#decimal"><span class="hs-pragma hs-type">decimal</span></a></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#Reader"><span class="hs-pragma hs-type">Reader</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int32"><span class="hs-pragma hs-type">Int32</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-52"></span><span class="hs-pragma">{-# SPECIALIZE</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#decimal"><span class="hs-pragma hs-type">decimal</span></a></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#Reader"><span class="hs-pragma hs-type">Reader</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int64"><span class="hs-pragma hs-type">Int64</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-53"></span><span class="hs-pragma">{-# SPECIALIZE</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#decimal"><span class="hs-pragma hs-type">decimal</span></a></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#Reader"><span class="hs-pragma hs-type">Reader</span></a></span><span> </span><span class="annot"><span class="hs-pragma hs-type">Integer</span></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-54"></span><span class="hs-pragma">{-# SPECIALIZE</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#decimal"><span class="hs-pragma hs-type">decimal</span></a></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#Reader"><span class="hs-pragma hs-type">Reader</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Word"><span class="hs-pragma hs-type">Data.Word.Word</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-55"></span><span class="hs-pragma">{-# SPECIALIZE</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#decimal"><span class="hs-pragma hs-type">decimal</span></a></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#Reader"><span class="hs-pragma hs-type">Reader</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-pragma hs-type">Word8</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-56"></span><span class="hs-pragma">{-# SPECIALIZE</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#decimal"><span class="hs-pragma hs-type">decimal</span></a></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#Reader"><span class="hs-pragma hs-type">Reader</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word16"><span class="hs-pragma hs-type">Word16</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-57"></span><span class="hs-pragma">{-# SPECIALIZE</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#decimal"><span class="hs-pragma hs-type">decimal</span></a></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#Reader"><span class="hs-pragma hs-type">Reader</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word32"><span class="hs-pragma hs-type">Word32</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-58"></span><span class="hs-pragma">{-# SPECIALIZE</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#decimal"><span class="hs-pragma hs-type">decimal</span></a></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#Reader"><span class="hs-pragma hs-type">Reader</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word64"><span class="hs-pragma hs-type">Word64</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-59"></span><span id="decimal"><span class="annot"><span class="annottext">decimal :: forall a. Integral a =&gt; Reader a
</span><a href="Data.Text.Lazy.Read.html#decimal"><span class="hs-identifier hs-var hs-var">decimal</span></a></span></span><span> </span><span id="local-6989586621679113680"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679113680"><span class="hs-identifier hs-var">txt</span></a></span></span><span>
</span><span id="line-60"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Bool
</span><a href="Data.Text.Lazy.html#null"><span class="hs-identifier hs-var">T.null</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679113678"><span class="hs-identifier hs-var">h</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Either String (a, Text)
forall a b. a -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Left"><span class="hs-identifier hs-var">Left</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;input does not start with a digit&quot;</span></span><span>
</span><span id="line-61"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a, Text) -&gt; Either String (a, Text)
forall a b. b -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Right"><span class="hs-identifier hs-var">Right</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(a -&gt; Char -&gt; a) -&gt; a -&gt; Text -&gt; a
forall a. (a -&gt; Char -&gt; a) -&gt; a -&gt; Text -&gt; a
</span><a href="Data.Text.Lazy.html#foldl%27"><span class="hs-identifier hs-var">T.foldl'</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Char -&gt; a
forall {a}. Num a =&gt; a -&gt; Char -&gt; a
</span><a href="#local-6989586621679113676"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679113678"><span class="hs-identifier hs-var">h</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679113675"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-62"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679113678"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679113678"><span class="hs-identifier hs-var">h</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679113675"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679113675"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; Text -&gt; (Text, Text)
</span><a href="Data.Text.Lazy.html#span"><span class="hs-identifier hs-var">T.span</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="../../base/src/GHC.Unicode.html#isDigit"><span class="hs-identifier hs-var">isDigit</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679113680"><span class="hs-identifier hs-var">txt</span></a></span><span>
</span><span id="line-63"></span><span>        </span><span id="local-6989586621679113676"><span class="annot"><span class="annottext">go :: a -&gt; Char -&gt; a
</span><a href="#local-6989586621679113676"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621679113667"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679113667"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621679113666"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679113666"><span class="hs-identifier hs-var">d</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679113667"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">10</span></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; a
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Int
</span><a href="Data.Text.Internal.Read.html#digitToInt"><span class="hs-identifier hs-var">digitToInt</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679113666"><span class="hs-identifier hs-var">d</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-64"></span><span>
</span><span id="line-65"></span><span class="hs-comment">-- | Read a hexadecimal integer, consisting of an optional leading</span><span>
</span><span id="line-66"></span><span class="hs-comment">-- @\&quot;0x\&quot;@ followed by at least one hexadecimal digit. Input is</span><span>
</span><span id="line-67"></span><span class="hs-comment">-- consumed until a non-hex-digit or end of string is reached.</span><span>
</span><span id="line-68"></span><span class="hs-comment">-- This function is case insensitive.</span><span>
</span><span id="line-69"></span><span class="hs-comment">--</span><span>
</span><span id="line-70"></span><span class="hs-comment">-- This function does not handle leading sign characters.  If you need</span><span>
</span><span id="line-71"></span><span class="hs-comment">-- to handle signed input, use @'signed' 'hexadecimal'@.</span><span>
</span><span id="line-72"></span><span class="hs-comment">--</span><span>
</span><span id="line-73"></span><span class="hs-comment">-- /Note/: For fixed-width integer types, this function does not</span><span>
</span><span id="line-74"></span><span class="hs-comment">-- attempt to detect overflow, so a sufficiently long input may give</span><span>
</span><span id="line-75"></span><span class="hs-comment">-- incorrect results.  If you are worried about overflow, use</span><span>
</span><span id="line-76"></span><span class="hs-comment">-- 'Integer' for your result type.</span><span>
</span><span id="line-77"></span><span id="local-6989586621679113662"><span class="annot"><a href="Data.Text.Lazy.Read.html#hexadecimal"><span class="hs-identifier hs-type">hexadecimal</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Real.html#Integral"><span class="hs-identifier hs-type">Integral</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679113662"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#Reader"><span class="hs-identifier hs-type">Reader</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679113662"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-78"></span><span class="hs-pragma">{-# SPECIALIZE</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#hexadecimal"><span class="hs-pragma hs-type">hexadecimal</span></a></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#Reader"><span class="hs-pragma hs-type">Reader</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-pragma hs-type">Int</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-79"></span><span class="hs-pragma">{-# SPECIALIZE</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#hexadecimal"><span class="hs-pragma hs-type">hexadecimal</span></a></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#Reader"><span class="hs-pragma hs-type">Reader</span></a></span><span> </span><span class="annot"><span class="hs-pragma hs-type">Integer</span></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-80"></span><span id="hexadecimal"><span class="annot"><span class="annottext">hexadecimal :: forall a. Integral a =&gt; Reader a
</span><a href="Data.Text.Lazy.Read.html#hexadecimal"><span class="hs-identifier hs-var hs-var">hexadecimal</span></a></span></span><span> </span><span id="local-6989586621679113652"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679113652"><span class="hs-identifier hs-var">txt</span></a></span></span><span>
</span><span id="line-81"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679113651"><span class="hs-identifier hs-var">h</span></a></span><span> </span><span class="annot"><span class="annottext">Text -&gt; Text -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><span class="hs-string">&quot;0x&quot;</span></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%7C%7C"><span class="hs-operator hs-var">||</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679113651"><span class="hs-identifier hs-var">h</span></a></span><span> </span><span class="annot"><span class="annottext">Text -&gt; Text -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><span class="hs-string">&quot;0X&quot;</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Reader a
forall a. Integral a =&gt; Reader a
</span><a href="Data.Text.Lazy.Read.html#hex"><span class="hs-identifier hs-var">hex</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679113648"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-82"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>              </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Reader a
forall a. Integral a =&gt; Reader a
</span><a href="Data.Text.Lazy.Read.html#hex"><span class="hs-identifier hs-var">hex</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679113652"><span class="hs-identifier hs-var">txt</span></a></span><span>
</span><span id="line-83"></span><span> </span><span class="hs-keyword">where</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679113651"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679113651"><span class="hs-identifier hs-var">h</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679113648"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679113648"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Text -&gt; (Text, Text)
</span><a href="Data.Text.Lazy.html#splitAt"><span class="hs-identifier hs-var">T.splitAt</span></a></span><span> </span><span class="annot"><span class="annottext">Int64
</span><span class="hs-number">2</span></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679113652"><span class="hs-identifier hs-var">txt</span></a></span><span>
</span><span id="line-84"></span><span>
</span><span id="line-85"></span><span id="local-6989586621679113645"><span class="annot"><a href="Data.Text.Lazy.Read.html#hex"><span class="hs-identifier hs-type">hex</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Real.html#Integral"><span class="hs-identifier hs-type">Integral</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679113645"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#Reader"><span class="hs-identifier hs-type">Reader</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679113645"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-86"></span><span class="hs-pragma">{-# SPECIALIZE</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#hexadecimal"><span class="hs-pragma hs-type">hexadecimal</span></a></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#Reader"><span class="hs-pragma hs-type">Reader</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-pragma hs-type">Int</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-87"></span><span class="hs-pragma">{-# SPECIALIZE</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#hexadecimal"><span class="hs-pragma hs-type">hexadecimal</span></a></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#Reader"><span class="hs-pragma hs-type">Reader</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int8"><span class="hs-pragma hs-type">Int8</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-88"></span><span class="hs-pragma">{-# SPECIALIZE</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#hexadecimal"><span class="hs-pragma hs-type">hexadecimal</span></a></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#Reader"><span class="hs-pragma hs-type">Reader</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int16"><span class="hs-pragma hs-type">Int16</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-89"></span><span class="hs-pragma">{-# SPECIALIZE</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#hexadecimal"><span class="hs-pragma hs-type">hexadecimal</span></a></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#Reader"><span class="hs-pragma hs-type">Reader</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int32"><span class="hs-pragma hs-type">Int32</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-90"></span><span class="hs-pragma">{-# SPECIALIZE</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#hexadecimal"><span class="hs-pragma hs-type">hexadecimal</span></a></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#Reader"><span class="hs-pragma hs-type">Reader</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int64"><span class="hs-pragma hs-type">Int64</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-91"></span><span class="hs-pragma">{-# SPECIALIZE</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#hexadecimal"><span class="hs-pragma hs-type">hexadecimal</span></a></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#Reader"><span class="hs-pragma hs-type">Reader</span></a></span><span> </span><span class="annot"><span class="hs-pragma hs-type">Integer</span></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-92"></span><span class="hs-pragma">{-# SPECIALIZE</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#hexadecimal"><span class="hs-pragma hs-type">hexadecimal</span></a></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#Reader"><span class="hs-pragma hs-type">Reader</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Word"><span class="hs-pragma hs-type">Word</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-93"></span><span class="hs-pragma">{-# SPECIALIZE</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#hexadecimal"><span class="hs-pragma hs-type">hexadecimal</span></a></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#Reader"><span class="hs-pragma hs-type">Reader</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-pragma hs-type">Word8</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-94"></span><span class="hs-pragma">{-# SPECIALIZE</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#hexadecimal"><span class="hs-pragma hs-type">hexadecimal</span></a></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#Reader"><span class="hs-pragma hs-type">Reader</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word16"><span class="hs-pragma hs-type">Word16</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-95"></span><span class="hs-pragma">{-# SPECIALIZE</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#hexadecimal"><span class="hs-pragma hs-type">hexadecimal</span></a></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#Reader"><span class="hs-pragma hs-type">Reader</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word32"><span class="hs-pragma hs-type">Word32</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-96"></span><span class="hs-pragma">{-# SPECIALIZE</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#hexadecimal"><span class="hs-pragma hs-type">hexadecimal</span></a></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#Reader"><span class="hs-pragma hs-type">Reader</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word64"><span class="hs-pragma hs-type">Word64</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-97"></span><span id="hex"><span class="annot"><span class="annottext">hex :: forall a. Integral a =&gt; Reader a
</span><a href="Data.Text.Lazy.Read.html#hex"><span class="hs-identifier hs-var hs-var">hex</span></a></span></span><span> </span><span id="local-6989586621679113638"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679113638"><span class="hs-identifier hs-var">txt</span></a></span></span><span>
</span><span id="line-98"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Bool
</span><a href="Data.Text.Lazy.html#null"><span class="hs-identifier hs-var">T.null</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679113637"><span class="hs-identifier hs-var">h</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Either String (a, Text)
forall a b. a -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Left"><span class="hs-identifier hs-var">Left</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;input does not start with a hexadecimal digit&quot;</span></span><span>
</span><span id="line-99"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a, Text) -&gt; Either String (a, Text)
forall a b. b -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Right"><span class="hs-identifier hs-var">Right</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(a -&gt; Char -&gt; a) -&gt; a -&gt; Text -&gt; a
forall a. (a -&gt; Char -&gt; a) -&gt; a -&gt; Text -&gt; a
</span><a href="Data.Text.Lazy.html#foldl%27"><span class="hs-identifier hs-var">T.foldl'</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Char -&gt; a
forall {a}. Num a =&gt; a -&gt; Char -&gt; a
</span><a href="#local-6989586621679113636"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679113637"><span class="hs-identifier hs-var">h</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679113635"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-100"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679113637"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679113637"><span class="hs-identifier hs-var">h</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679113635"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679113635"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; Text -&gt; (Text, Text)
</span><a href="Data.Text.Lazy.html#span"><span class="hs-identifier hs-var">T.span</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="../../base/src/GHC.Unicode.html#isHexDigit"><span class="hs-identifier hs-var">isHexDigit</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679113638"><span class="hs-identifier hs-var">txt</span></a></span><span>
</span><span id="line-101"></span><span>        </span><span id="local-6989586621679113636"><span class="annot"><span class="annottext">go :: a -&gt; Char -&gt; a
</span><a href="#local-6989586621679113636"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621679113628"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679113628"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621679113627"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679113627"><span class="hs-identifier hs-var">d</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679113628"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">16</span></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; a
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Int
</span><a href="Data.Text.Internal.Read.html#hexDigitToInt"><span class="hs-identifier hs-var">hexDigitToInt</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679113627"><span class="hs-identifier hs-var">d</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-102"></span><span>
</span><span id="line-103"></span><span class="hs-comment">-- | Read an optional leading sign character (@\'-\'@ or @\'+\'@) and</span><span>
</span><span id="line-104"></span><span class="hs-comment">-- apply it to the result of applying the given reader.</span><span>
</span><span id="line-105"></span><span id="local-6989586621679113796"><span class="annot"><a href="Data.Text.Lazy.Read.html#signed"><span class="hs-identifier hs-type">signed</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Num.html#Num"><span class="hs-identifier hs-type">Num</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679113796"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#Reader"><span class="hs-identifier hs-type">Reader</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679113796"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#Reader"><span class="hs-identifier hs-type">Reader</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679113796"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-106"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#signed"><span class="hs-pragma hs-type">signed</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-107"></span><span id="signed"><span class="annot"><span class="annottext">signed :: forall a. Num a =&gt; Reader a -&gt; Reader a
</span><a href="Data.Text.Lazy.Read.html#signed"><span class="hs-identifier hs-var hs-var">signed</span></a></span></span><span> </span><span id="local-6989586621679113623"><span class="annot"><span class="annottext">Reader a
</span><a href="#local-6989586621679113623"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IParser Text a -&gt; Reader a
forall t a. IParser t a -&gt; IReader t a
</span><a href="Data.Text.Internal.Read.html#runP"><span class="hs-identifier hs-var hs-var">runP</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IParser Text a -&gt; IParser Text a
forall a. Num a =&gt; Parser a -&gt; Parser a
</span><a href="Data.Text.Lazy.Read.html#signa"><span class="hs-identifier hs-var">signa</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Reader a -&gt; IParser Text a
forall t a. IReader t a -&gt; IParser t a
</span><a href="Data.Text.Internal.Read.html#P"><span class="hs-identifier hs-var">P</span></a></span><span> </span><span class="annot"><span class="annottext">Reader a
</span><a href="#local-6989586621679113623"><span class="hs-identifier hs-var">f</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-108"></span><span>
</span><span id="line-109"></span><span class="hs-comment">-- | Read a rational number.</span><span>
</span><span id="line-110"></span><span class="hs-comment">--</span><span>
</span><span id="line-111"></span><span class="hs-comment">-- This function accepts an optional leading sign character, followed</span><span>
</span><span id="line-112"></span><span class="hs-comment">-- by at least one decimal digit.  The syntax similar to that accepted</span><span>
</span><span id="line-113"></span><span class="hs-comment">-- by the 'read' function, with the exception that a trailing @\'.\'@</span><span>
</span><span id="line-114"></span><span class="hs-comment">-- or @\'e\'@ /not/ followed by a number is not consumed.</span><span>
</span><span id="line-115"></span><span class="hs-comment">--</span><span>
</span><span id="line-116"></span><span class="hs-comment">-- Examples:</span><span>
</span><span id="line-117"></span><span class="hs-comment">--</span><span>
</span><span id="line-118"></span><span class="hs-comment">-- &gt;rational &quot;3&quot;     == Right (3.0, &quot;&quot;)</span><span>
</span><span id="line-119"></span><span class="hs-comment">-- &gt;rational &quot;3.1&quot;   == Right (3.1, &quot;&quot;)</span><span>
</span><span id="line-120"></span><span class="hs-comment">-- &gt;rational &quot;3e4&quot;   == Right (30000.0, &quot;&quot;)</span><span>
</span><span id="line-121"></span><span class="hs-comment">-- &gt;rational &quot;3.1e4&quot; == Right (31000.0, &quot;&quot;)</span><span>
</span><span id="line-122"></span><span class="hs-comment">-- &gt;rational &quot;.3&quot;    == Left &quot;input does not start with a digit&quot;</span><span>
</span><span id="line-123"></span><span class="hs-comment">-- &gt;rational &quot;e3&quot;    == Left &quot;input does not start with a digit&quot;</span><span>
</span><span id="line-124"></span><span class="hs-comment">--</span><span>
</span><span id="line-125"></span><span class="hs-comment">-- Examples of differences from 'read':</span><span>
</span><span id="line-126"></span><span class="hs-comment">--</span><span>
</span><span id="line-127"></span><span class="hs-comment">-- &gt;rational &quot;3.foo&quot; == Right (3.0, &quot;.foo&quot;)</span><span>
</span><span id="line-128"></span><span class="hs-comment">-- &gt;rational &quot;3e&quot;    == Right (3.0, &quot;e&quot;)</span><span>
</span><span id="line-129"></span><span id="local-6989586621679113788"><span class="annot"><a href="Data.Text.Lazy.Read.html#rational"><span class="hs-identifier hs-type">rational</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Real.html#Fractional"><span class="hs-identifier hs-type">Fractional</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679113788"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#Reader"><span class="hs-identifier hs-type">Reader</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679113788"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-130"></span><span class="hs-pragma">{-# SPECIALIZE</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#rational"><span class="hs-pragma hs-type">rational</span></a></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#Reader"><span class="hs-pragma hs-type">Reader</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Double"><span class="hs-pragma hs-type">Double</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-131"></span><span id="rational"><span class="annot"><span class="annottext">rational :: forall a. Fractional a =&gt; Reader a
</span><a href="Data.Text.Lazy.Read.html#rational"><span class="hs-identifier hs-var hs-var">rational</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Integer -&gt; Integer -&gt; Integer -&gt; a) -&gt; Reader a
forall a.
Fractional a =&gt;
(Integer -&gt; Integer -&gt; Integer -&gt; a) -&gt; Reader a
</span><a href="Data.Text.Lazy.Read.html#floaty"><span class="hs-identifier hs-var">floaty</span></a></span><span> </span><span class="annot"><span class="annottext">((Integer -&gt; Integer -&gt; Integer -&gt; a) -&gt; Reader a)
-&gt; (Integer -&gt; Integer -&gt; Integer -&gt; a) -&gt; Reader a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679113610"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679113610"><span class="hs-identifier hs-var">real</span></a></span></span><span> </span><span id="local-6989586621679113609"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679113609"><span class="hs-identifier hs-var">frac</span></a></span></span><span> </span><span id="local-6989586621679113608"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679113608"><span class="hs-identifier hs-var">fracDenom</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Ratio Integer -&gt; a
forall a. Fractional a =&gt; Ratio Integer -&gt; a
</span><a href="../../base/src/GHC.Real.html#fromRational"><span class="hs-identifier hs-var">fromRational</span></a></span><span> </span><span class="annot"><span class="annottext">(Ratio Integer -&gt; a) -&gt; Ratio Integer -&gt; a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-132"></span><span>                     </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679113610"><span class="hs-identifier hs-var">real</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Ratio Integer
forall a. Integral a =&gt; a -&gt; a -&gt; Ratio a
</span><a href="../../base/src/GHC.Real.html#%25"><span class="hs-operator hs-var">%</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">Ratio Integer -&gt; Ratio Integer -&gt; Ratio Integer
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679113609"><span class="hs-identifier hs-var">frac</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Ratio Integer
forall a. Integral a =&gt; a -&gt; a -&gt; Ratio a
</span><a href="../../base/src/GHC.Real.html#%25"><span class="hs-operator hs-var">%</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679113608"><span class="hs-identifier hs-var">fracDenom</span></a></span><span>
</span><span id="line-133"></span><span>
</span><span id="line-134"></span><span class="hs-comment">-- | Read a rational number.</span><span>
</span><span id="line-135"></span><span class="hs-comment">--</span><span>
</span><span id="line-136"></span><span class="hs-comment">-- The syntax accepted by this function is the same as for 'rational'.</span><span>
</span><span id="line-137"></span><span class="hs-comment">--</span><span>
</span><span id="line-138"></span><span class="hs-comment">-- /Note/: This function is almost ten times faster than 'rational',</span><span>
</span><span id="line-139"></span><span class="hs-comment">-- but is slightly less accurate.</span><span>
</span><span id="line-140"></span><span class="hs-comment">--</span><span>
</span><span id="line-141"></span><span class="hs-comment">-- The 'Double' type supports about 16 decimal places of accuracy.</span><span>
</span><span id="line-142"></span><span class="hs-comment">-- For 94.2% of numbers, this function and 'rational' give identical</span><span>
</span><span id="line-143"></span><span class="hs-comment">-- results, but for the remaining 5.8%, this function loses precision</span><span>
</span><span id="line-144"></span><span class="hs-comment">-- around the 15th decimal place.  For 0.001% of numbers, this</span><span>
</span><span id="line-145"></span><span class="hs-comment">-- function will lose precision at the 13th or 14th decimal place.</span><span>
</span><span id="line-146"></span><span class="annot"><a href="Data.Text.Lazy.Read.html#double"><span class="hs-identifier hs-type">double</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#Reader"><span class="hs-identifier hs-type">Reader</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Double"><span class="hs-identifier hs-type">Double</span></a></span><span>
</span><span id="line-147"></span><span id="double"><span class="annot"><span class="annottext">double :: Reader Double
</span><a href="Data.Text.Lazy.Read.html#double"><span class="hs-identifier hs-var hs-var">double</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Integer -&gt; Integer -&gt; Integer -&gt; Double) -&gt; Reader Double
forall a.
Fractional a =&gt;
(Integer -&gt; Integer -&gt; Integer -&gt; a) -&gt; Reader a
</span><a href="Data.Text.Lazy.Read.html#floaty"><span class="hs-identifier hs-var">floaty</span></a></span><span> </span><span class="annot"><span class="annottext">((Integer -&gt; Integer -&gt; Integer -&gt; Double) -&gt; Reader Double)
-&gt; (Integer -&gt; Integer -&gt; Integer -&gt; Double) -&gt; Reader Double
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679113607"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679113607"><span class="hs-identifier hs-var">real</span></a></span></span><span> </span><span id="local-6989586621679113606"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679113606"><span class="hs-identifier hs-var">frac</span></a></span></span><span> </span><span id="local-6989586621679113605"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679113605"><span class="hs-identifier hs-var">fracDenom</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-148"></span><span>                   </span><span class="annot"><span class="annottext">Integer -&gt; Double
forall a. Num a =&gt; Integer -&gt; a
</span><a href="../../base/src/GHC.Num.html#fromInteger"><span class="hs-identifier hs-var">fromInteger</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679113607"><span class="hs-identifier hs-var">real</span></a></span><span> </span><span class="annot"><span class="annottext">Double -&gt; Double -&gt; Double
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span>
</span><span id="line-149"></span><span>                   </span><span class="annot"><span class="annottext">Integer -&gt; Double
forall a. Num a =&gt; Integer -&gt; a
</span><a href="../../base/src/GHC.Num.html#fromInteger"><span class="hs-identifier hs-var">fromInteger</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679113606"><span class="hs-identifier hs-var">frac</span></a></span><span> </span><span class="annot"><span class="annottext">Double -&gt; Double -&gt; Double
forall a. Fractional a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Real.html#%2F"><span class="hs-operator hs-var">/</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Double
forall a. Num a =&gt; Integer -&gt; a
</span><a href="../../base/src/GHC.Num.html#fromInteger"><span class="hs-identifier hs-var">fromInteger</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679113605"><span class="hs-identifier hs-var">fracDenom</span></a></span><span>
</span><span id="line-150"></span><span>
</span><span id="line-151"></span><span id="local-6989586621679113790"><span class="annot"><a href="Data.Text.Lazy.Read.html#signa"><span class="hs-identifier hs-type">signa</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Num.html#Num"><span class="hs-identifier hs-type">Num</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679113790"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#Parser"><span class="hs-identifier hs-type">Parser</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679113790"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#Parser"><span class="hs-identifier hs-type">Parser</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679113790"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-152"></span><span class="hs-pragma">{-# SPECIALIZE</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#signa"><span class="hs-pragma hs-type">signa</span></a></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#Parser"><span class="hs-pragma hs-type">Parser</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-pragma hs-type">Int</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#Parser"><span class="hs-pragma hs-type">Parser</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-pragma hs-type">Int</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-153"></span><span class="hs-pragma">{-# SPECIALIZE</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#signa"><span class="hs-pragma hs-type">signa</span></a></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#Parser"><span class="hs-pragma hs-type">Parser</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int8"><span class="hs-pragma hs-type">Int8</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#Parser"><span class="hs-pragma hs-type">Parser</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int8"><span class="hs-pragma hs-type">Int8</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-154"></span><span class="hs-pragma">{-# SPECIALIZE</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#signa"><span class="hs-pragma hs-type">signa</span></a></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#Parser"><span class="hs-pragma hs-type">Parser</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int16"><span class="hs-pragma hs-type">Int16</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#Parser"><span class="hs-pragma hs-type">Parser</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int16"><span class="hs-pragma hs-type">Int16</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-155"></span><span class="hs-pragma">{-# SPECIALIZE</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#signa"><span class="hs-pragma hs-type">signa</span></a></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#Parser"><span class="hs-pragma hs-type">Parser</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int32"><span class="hs-pragma hs-type">Int32</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#Parser"><span class="hs-pragma hs-type">Parser</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int32"><span class="hs-pragma hs-type">Int32</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-156"></span><span class="hs-pragma">{-# SPECIALIZE</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#signa"><span class="hs-pragma hs-type">signa</span></a></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#Parser"><span class="hs-pragma hs-type">Parser</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int64"><span class="hs-pragma hs-type">Int64</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#Parser"><span class="hs-pragma hs-type">Parser</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int64"><span class="hs-pragma hs-type">Int64</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-157"></span><span class="hs-pragma">{-# SPECIALIZE</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#signa"><span class="hs-pragma hs-type">signa</span></a></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#Parser"><span class="hs-pragma hs-type">Parser</span></a></span><span> </span><span class="annot"><span class="hs-pragma hs-type">Integer</span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#Parser"><span class="hs-pragma hs-type">Parser</span></a></span><span> </span><span class="annot"><span class="hs-pragma hs-type">Integer</span></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-158"></span><span id="signa"><span class="annot"><span class="annottext">signa :: forall a. Num a =&gt; Parser a -&gt; Parser a
</span><a href="Data.Text.Lazy.Read.html#signa"><span class="hs-identifier hs-var hs-var">signa</span></a></span></span><span> </span><span id="local-6989586621679113594"><span class="annot"><span class="annottext">Parser a
</span><a href="#local-6989586621679113594"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-159"></span><span>  </span><span id="local-6989586621679113593"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679113593"><span class="hs-identifier hs-var">sign</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Char -&gt; IParser Text Char -&gt; IParser Text Char
forall a t. a -&gt; IParser t a -&gt; IParser t a
</span><a href="Data.Text.Internal.Read.html#perhaps"><span class="hs-identifier hs-var">perhaps</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'+'</span></span><span> </span><span class="annot"><span class="annottext">(IParser Text Char -&gt; IParser Text Char)
-&gt; IParser Text Char -&gt; IParser Text Char
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; IParser Text Char
</span><a href="Data.Text.Lazy.Read.html#char"><span class="hs-identifier hs-var">char</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621679113590"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679113590"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679113590"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'-'</span></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%7C%7C"><span class="hs-operator hs-var">||</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679113590"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'+'</span></span><span class="hs-special">)</span><span>
</span><span id="line-160"></span><span>  </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679113593"><span class="hs-identifier hs-var">sign</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'+'</span></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Parser a
</span><a href="#local-6989586621679113594"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">a -&gt; a
forall a. Num a =&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#negate"><span class="hs-identifier hs-var">negate</span></a></span><span> </span><span class="annot"><span class="annottext">(a -&gt; a) -&gt; Parser a -&gt; Parser a
forall (m :: * -&gt; *) a1 r. Monad m =&gt; (a1 -&gt; r) -&gt; m a1 -&gt; m r
</span><a href="../../base/src/GHC.Base.html#liftM"><span class="hs-operator hs-var">`liftM`</span></a></span><span> </span><span class="annot"><span class="annottext">Parser a
</span><a href="#local-6989586621679113594"><span class="hs-identifier hs-var">p</span></a></span><span>
</span><span id="line-161"></span><span>
</span><span id="line-162"></span><span class="annot"><a href="Data.Text.Lazy.Read.html#char"><span class="hs-identifier hs-type">char</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#Parser"><span class="hs-identifier hs-type">Parser</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span>
</span><span id="line-163"></span><span id="char"><span class="annot"><span class="annottext">char :: (Char -&gt; Bool) -&gt; IParser Text Char
</span><a href="Data.Text.Lazy.Read.html#char"><span class="hs-identifier hs-var hs-var">char</span></a></span></span><span> </span><span id="local-6989586621679113589"><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679113589"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IReader Text Char -&gt; IParser Text Char
forall t a. IReader t a -&gt; IParser t a
</span><a href="Data.Text.Internal.Read.html#P"><span class="hs-identifier hs-var">P</span></a></span><span> </span><span class="annot"><span class="annottext">(IReader Text Char -&gt; IParser Text Char)
-&gt; IReader Text Char -&gt; IParser Text Char
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679113588"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679113588"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Maybe (Char, Text)
</span><a href="Data.Text.Lazy.html#uncons"><span class="hs-identifier hs-var">T.uncons</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679113588"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-164"></span><span>                     </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679113586"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679113586"><span class="hs-identifier hs-var">c</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679113585"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679113585"><span class="hs-identifier hs-var">t'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679113589"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679113586"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(Char, Text) -&gt; Either String (Char, Text)
forall a b. b -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Right"><span class="hs-identifier hs-var">Right</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679113586"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679113585"><span class="hs-identifier hs-var">t'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-165"></span><span>                     </span><span class="annot"><span class="annottext">Maybe (Char, Text)
</span><span class="hs-identifier">_</span></span><span>                 </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; Either String (Char, Text)
forall a b. a -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Left"><span class="hs-identifier hs-var">Left</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;character does not match&quot;</span></span><span>
</span><span id="line-166"></span><span>
</span><span id="line-167"></span><span id="local-6989586621679113785"><span class="annot"><a href="Data.Text.Lazy.Read.html#floaty"><span class="hs-identifier hs-type">floaty</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Real.html#Fractional"><span class="hs-identifier hs-type">Fractional</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679113785"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Integer</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Integer</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Integer</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679113785"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#Reader"><span class="hs-identifier hs-type">Reader</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679113785"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-168"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#floaty"><span class="hs-pragma hs-type">floaty</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-169"></span><span id="floaty"><span class="annot"><span class="annottext">floaty :: forall a.
Fractional a =&gt;
(Integer -&gt; Integer -&gt; Integer -&gt; a) -&gt; Reader a
</span><a href="Data.Text.Lazy.Read.html#floaty"><span class="hs-identifier hs-var hs-var">floaty</span></a></span></span><span> </span><span id="local-6989586621679113561"><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer -&gt; a
</span><a href="#local-6989586621679113561"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IParser Text a -&gt; IReader Text a
forall t a. IParser t a -&gt; IReader t a
</span><a href="Data.Text.Internal.Read.html#runP"><span class="hs-identifier hs-var hs-var">runP</span></a></span><span> </span><span class="annot"><span class="annottext">(IParser Text a -&gt; IReader Text a)
-&gt; IParser Text a -&gt; IReader Text a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-170"></span><span>  </span><span id="local-6989586621679113560"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679113560"><span class="hs-identifier hs-var">sign</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Char -&gt; IParser Text Char -&gt; IParser Text Char
forall a t. a -&gt; IParser t a -&gt; IParser t a
</span><a href="Data.Text.Internal.Read.html#perhaps"><span class="hs-identifier hs-var">perhaps</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'+'</span></span><span> </span><span class="annot"><span class="annottext">(IParser Text Char -&gt; IParser Text Char)
-&gt; IParser Text Char -&gt; IParser Text Char
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; IParser Text Char
</span><a href="Data.Text.Lazy.Read.html#char"><span class="hs-identifier hs-var">char</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621679113559"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679113559"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679113559"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'-'</span></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%7C%7C"><span class="hs-operator hs-var">||</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679113559"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'+'</span></span><span class="hs-special">)</span><span>
</span><span id="line-171"></span><span>  </span><span id="local-6989586621679113558"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679113558"><span class="hs-identifier hs-var">real</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IReader Text Integer -&gt; IParser Text Integer
forall t a. IReader t a -&gt; IParser t a
</span><a href="Data.Text.Internal.Read.html#P"><span class="hs-identifier hs-var">P</span></a></span><span> </span><span class="annot"><span class="annottext">IReader Text Integer
forall a. Integral a =&gt; Reader a
</span><a href="Data.Text.Lazy.Read.html#decimal"><span class="hs-identifier hs-var">decimal</span></a></span><span>
</span><span id="line-172"></span><span>  </span><span class="annot"><a href="Data.Text.Internal.Read.html#T"><span class="hs-identifier hs-type">T</span></a></span><span> </span><span id="local-6989586621679113556"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679113556"><span class="hs-identifier hs-var">fraction</span></a></span></span><span> </span><span id="local-6989586621679113555"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679113555"><span class="hs-identifier hs-var">fracDigits</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">T -&gt; IParser Text T -&gt; IParser Text T
forall a t. a -&gt; IParser t a -&gt; IParser t a
</span><a href="Data.Text.Internal.Read.html#perhaps"><span class="hs-identifier hs-var">perhaps</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer -&gt; Int -&gt; T
</span><a href="Data.Text.Internal.Read.html#T"><span class="hs-identifier hs-var">T</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(IParser Text T -&gt; IParser Text T)
-&gt; IParser Text T -&gt; IParser Text T
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-173"></span><span>    </span><span class="annot"><span class="annottext">Char
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; IParser Text Char
</span><a href="Data.Text.Lazy.Read.html#char"><span class="hs-identifier hs-var">char</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'.'</span></span><span class="hs-special">)</span><span>
</span><span id="line-174"></span><span>    </span><span id="local-6989586621679113554"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679113554"><span class="hs-identifier hs-var">digits</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IReader Text Int -&gt; IParser Text Int
forall t a. IReader t a -&gt; IParser t a
</span><a href="Data.Text.Internal.Read.html#P"><span class="hs-identifier hs-var">P</span></a></span><span> </span><span class="annot"><span class="annottext">(IReader Text Int -&gt; IParser Text Int)
-&gt; IReader Text Int -&gt; IParser Text Int
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679113553"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679113553"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(Int, Text) -&gt; Either String (Int, Text)
forall a b. b -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Right"><span class="hs-identifier hs-var">Right</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int64 -&gt; Int
</span><a href="Data.Text.Lazy.Read.html#int64ToInt"><span class="hs-identifier hs-var">int64ToInt</span></a></span><span> </span><span class="annot"><span class="annottext">(Int64 -&gt; Int) -&gt; (Text -&gt; Int64) -&gt; Text -&gt; Int
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Text -&gt; Int64
</span><a href="Data.Text.Lazy.html#length"><span class="hs-identifier hs-var">T.length</span></a></span><span> </span><span class="annot"><span class="annottext">(Text -&gt; Int) -&gt; Text -&gt; Int
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; Text -&gt; Text
</span><a href="Data.Text.Lazy.html#takeWhile"><span class="hs-identifier hs-var">T.takeWhile</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="../../base/src/GHC.Unicode.html#isDigit"><span class="hs-identifier hs-var">isDigit</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679113553"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679113553"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-175"></span><span>    </span><span id="local-6989586621679113548"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679113548"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IReader Text Integer -&gt; IParser Text Integer
forall t a. IReader t a -&gt; IParser t a
</span><a href="Data.Text.Internal.Read.html#P"><span class="hs-identifier hs-var">P</span></a></span><span> </span><span class="annot"><span class="annottext">IReader Text Integer
forall a. Integral a =&gt; Reader a
</span><a href="Data.Text.Lazy.Read.html#decimal"><span class="hs-identifier hs-var">decimal</span></a></span><span>
</span><span id="line-176"></span><span>    </span><span class="annot"><span class="annottext">T -&gt; IParser Text T
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(T -&gt; IParser Text T) -&gt; T -&gt; IParser Text T
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Int -&gt; T
</span><a href="Data.Text.Internal.Read.html#T"><span class="hs-identifier hs-var">T</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679113548"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679113554"><span class="hs-identifier hs-var">digits</span></a></span><span>
</span><span id="line-177"></span><span>  </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679113545"><span class="annot"><span class="annottext">e :: Char -&gt; Bool
</span><a href="#local-6989586621679113545"><span class="hs-identifier hs-var hs-var">e</span></a></span></span><span> </span><span id="local-6989586621679113544"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679113544"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679113544"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'e'</span></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%7C%7C"><span class="hs-operator hs-var">||</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679113544"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'E'</span></span><span>
</span><span id="line-178"></span><span>  </span><span id="local-6989586621679113543"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679113543"><span class="hs-identifier hs-var">power</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Int -&gt; IParser Text Int -&gt; IParser Text Int
forall a t. a -&gt; IParser t a -&gt; IParser t a
</span><a href="Data.Text.Internal.Read.html#perhaps"><span class="hs-identifier hs-var">perhaps</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; IParser Text Char
</span><a href="Data.Text.Lazy.Read.html#char"><span class="hs-identifier hs-var">char</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679113545"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="annot"><span class="annottext">IParser Text Char -&gt; IParser Text Int -&gt; IParser Text Int
forall (m :: * -&gt; *) a b. Monad m =&gt; m a -&gt; m b -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3E%3E"><span class="hs-operator hs-var">&gt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">IParser Text Int -&gt; IParser Text Int
forall a. Num a =&gt; Parser a -&gt; Parser a
</span><a href="Data.Text.Lazy.Read.html#signa"><span class="hs-identifier hs-var">signa</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IReader Text Int -&gt; IParser Text Int
forall t a. IReader t a -&gt; IParser t a
</span><a href="Data.Text.Internal.Read.html#P"><span class="hs-identifier hs-var">P</span></a></span><span> </span><span class="annot"><span class="annottext">IReader Text Int
forall a. Integral a =&gt; Reader a
</span><a href="Data.Text.Lazy.Read.html#decimal"><span class="hs-identifier hs-var">decimal</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Lazy.Read.html#Parser"><span class="hs-identifier hs-type">Parser</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-179"></span><span>  </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679113519"><span class="annot"><span class="annottext">n :: a
</span><a href="#local-6989586621679113519"><span class="hs-identifier hs-var hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679113555"><span class="hs-identifier hs-var">fracDigits</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>
</span><span id="line-180"></span><span>          </span><span class="hs-keyword">then</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679113543"><span class="hs-identifier hs-var">power</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>
</span><span id="line-181"></span><span>               </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; a
forall a. Num a =&gt; Integer -&gt; a
</span><a href="../../base/src/GHC.Num.html#fromInteger"><span class="hs-identifier hs-var">fromInteger</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679113558"><span class="hs-identifier hs-var">real</span></a></span><span>
</span><span id="line-182"></span><span>               </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; a
forall a. Num a =&gt; Integer -&gt; a
</span><a href="../../base/src/GHC.Num.html#fromInteger"><span class="hs-identifier hs-var">fromInteger</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679113558"><span class="hs-identifier hs-var">real</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><span class="hs-number">10</span></span><span> </span><span class="annot"><span class="annottext">a -&gt; Int -&gt; a
forall a b. (Fractional a, Integral b) =&gt; a -&gt; b -&gt; a
</span><a href="../../base/src/GHC.Real.html#%5E%5E"><span class="hs-operator hs-var">^^</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679113543"><span class="hs-identifier hs-var">power</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-183"></span><span>          </span><span class="hs-keyword">else</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679113543"><span class="hs-identifier hs-var">power</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>
</span><span id="line-184"></span><span>               </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer -&gt; a
</span><a href="#local-6989586621679113561"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679113558"><span class="hs-identifier hs-var">real</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679113556"><span class="hs-identifier hs-var">fraction</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">10</span></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Int -&gt; Integer
forall a b. (Num a, Integral b) =&gt; a -&gt; b -&gt; a
</span><a href="../../base/src/GHC.Real.html#%5E"><span class="hs-operator hs-var">^</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679113555"><span class="hs-identifier hs-var">fracDigits</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-185"></span><span>               </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer -&gt; a
</span><a href="#local-6989586621679113561"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679113558"><span class="hs-identifier hs-var">real</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679113556"><span class="hs-identifier hs-var">fraction</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">10</span></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Int -&gt; Integer
forall a b. (Num a, Integral b) =&gt; a -&gt; b -&gt; a
</span><a href="../../base/src/GHC.Real.html#%5E"><span class="hs-operator hs-var">^</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679113555"><span class="hs-identifier hs-var">fracDigits</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><span class="hs-number">10</span></span><span> </span><span class="annot"><span class="annottext">a -&gt; Int -&gt; a
forall a b. (Fractional a, Integral b) =&gt; a -&gt; b -&gt; a
</span><a href="../../base/src/GHC.Real.html#%5E%5E"><span class="hs-operator hs-var">^^</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679113543"><span class="hs-identifier hs-var">power</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-186"></span><span>  </span><span class="annot"><span class="annottext">a -&gt; IParser Text a
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(a -&gt; IParser Text a) -&gt; a -&gt; IParser Text a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679113560"><span class="hs-identifier hs-var">sign</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'+'</span></span><span>
</span><span id="line-187"></span><span>            </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679113519"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-188"></span><span>            </span><span class="hs-keyword">else</span><span> </span><span class="hs-glyph">-</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679113519"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-189"></span><span>
</span><span id="line-190"></span><span class="annot"><a href="Data.Text.Lazy.Read.html#int64ToInt"><span class="hs-identifier hs-type">int64ToInt</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int64"><span class="hs-identifier hs-type">Int64</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span>
</span><span id="line-191"></span><span id="int64ToInt"><span class="annot"><span class="annottext">int64ToInt :: Int64 -&gt; Int
</span><a href="Data.Text.Lazy.Read.html#int64ToInt"><span class="hs-identifier hs-var hs-var">int64ToInt</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int64 -&gt; Int
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span>
</span><span id="line-192"></span></pre></body></html>